If you use this code in your work or research, we kindly request that you cite our publication:
Xiaofan Lu, et al. (2025). FigureYa: A Standardized Visualization Framework for Enhancing Biomedical Data Interpretation and Research Efficiency. iMetaMed. https://doi.org/10.1002/imm3.70005
用R复现文章里的图
Reproduce a diagram from an article in R
出自https://onlinelibrary.wiley.com/doi/abs/10.1111/all.13222
fromhttps://onlinelibrary.wiley.com/doi/abs/10.1111/all.13222
visualizing genomic variations, including mutation patterns, copy number variations (CNVs), expression patterns, and methylation patterns.
支持hg18、hg19、mm9、mm10
例如像例文那样展示多个芯片基因的表达变化和之间的link关系
Support hg18, hg19, mm9, mm10
For example, displaying the expression changes of multiple chip genes and the link relationships between them as in the example text
参考资料:https://journals.sagepub.com/doi/10.4137/CIN.S13495
https://www.bioconductor.org/packages/devel/bioc/html/OmicCircos.html
reference: https://journals.sagepub.com/doi/10.4137/CIN.S13495
https://www.bioconductor.org/packages/devel/bioc/html/OmicCircos.html
source("install_dependencies.R")
## Starting R package installation...
## ===========================================
##
## Installing Bioconductor packages...
## Package already installed: OmicCircos
## Package already installed: S4Vectors
##
## Installing CRAN packages...
## Package already installed: tidyverse
##
## ===========================================
## Package installation completed!
##
## Verifying package installation:
## ✓ OmicCircos is installed
## ✓ S4Vectors is installed
## ✓ tidyverse is installed
##
## You can now run your R scripts in this directory.
# 加载必要的R包 / Load necessary R packages
library(S4Vectors) # 提供S4向量数据结构 / Provides S4 vector data structures
## Loading required package: stats4
## Loading required package: BiocGenerics
## Loading required package: generics
##
## Attaching package: 'generics'
## The following objects are masked from 'package:base':
##
## as.difftime, as.factor, as.ordered, intersect, is.element, setdiff,
## setequal, union
##
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:stats':
##
## IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
##
## anyDuplicated, aperm, append, as.data.frame, basename, cbind,
## colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
## get, grep, grepl, is.unsorted, lapply, Map, mapply, match, mget,
## order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
## rbind, Reduce, rownames, sapply, saveRDS, table, tapply, unique,
## unsplit, which.max, which.min
##
## Attaching package: 'S4Vectors'
## The following object is masked from 'package:utils':
##
## findMatches
## The following objects are masked from 'package:base':
##
## expand.grid, I, unname
library(tidyverse) # 数据清洗和分析工具集 / Data cleaning and analysis toolkit
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.2
## ✔ ggplot2 4.0.0 ✔ tibble 3.3.0
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.1.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::combine() masks BiocGenerics::combine()
## ✖ tidyr::expand() masks S4Vectors::expand()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::first() masks S4Vectors::first()
## ✖ dplyr::lag() masks stats::lag()
## ✖ ggplot2::Position() masks BiocGenerics::Position(), base::Position()
## ✖ dplyr::rename() masks S4Vectors::rename()
## ✖ lubridate::second() masks S4Vectors::second()
## ✖ lubridate::second<-() masks S4Vectors::second<-()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(OmicCircos) # 用于绘制环形基因组图 / For drawing circular genomic plots
## Loading required package: GenomicRanges
## Loading required package: IRanges
##
## Attaching package: 'IRanges'
##
## The following object is masked from 'package:lubridate':
##
## %within%
##
## The following objects are masked from 'package:dplyr':
##
## collapse, desc, slice
##
## The following object is masked from 'package:purrr':
##
## reduce
##
## Loading required package: GenomeInfoDb
# 设置R环境显示英文报错信息 / Set R environment to display error messages in English
Sys.setenv(LANGUAGE = "en")
# 防止字符串自动转换为因子 / Prevent automatic conversion of strings to factors
options(stringsAsFactors = FALSE)
如果你的数据已经保存为easy_input.csv格式,就可以跳过这步,进入“开始画图”
gene.location.csv,基因在染色体上的位置。至少包括基因所在的染色体、起始位置、基因 ID(例如ensembl ID、ENTREZ ID、gene symbol)。此处以人为例,对应hg19版本,来自TCGAbiolinks。
signal.csv,图中基因的信号值。第一列是gene ID,跟gene.location.csv里的一种基因ID一致,此处是gene symbol;第二列是图中基因名及其连线的颜色,红色连红色,蓝色连蓝色,你也可以写成其他颜色;第三列之后是三组样品的signal,第一组有两个,第二组有三个,第三组有三个。可以是RNA-seq、ChIP-seq、ATAC-seq、CNV、DNA甲基化等信息。用感兴趣的区段信息替换示例中的基因信息。
If your data has already been saved in easy_input.csv format, you can skip this step and enter “Start Drawing”
gene.location.csv, The position of genes on chromosomes. At least including the chromosome where the gene is located, the starting position, and the gene ID (such as ensembl ID, ENTREZ ID, gene symbol). Here is a human example, corresponding to the hg19 version, from TCGAbiolinks.
signal.csv, The signal values of genes in the figure. The first column is the gene ID, which is consistent with a gene ID in gene.location.csv. Here is the gene symbol; The second column is the color of the gene names and their connecting lines in the figure. Red is connected to red, blue is connected to blue, or you can write them in other colors; After the third column are the signals of three groups of samples, the first group has two, the second group has three, and the third group has three. It can be information such as RNA seq, ChIP seq, ATAC seq, CNV, DNA methylation, etc. Replace the gene information in the example with the segment information of interest.
# 读取基因位置文件 / Read gene location file
# 文件应包含染色体位置和基因ID信息 / File should contain chromosome locations and gene IDs
gene.location <- read.csv("gene.location.csv")
head(gene.location) # 查看前几行数据 / Check the first few rows of data
## chromosome_name start_position end_position strand ensembl_gene_id entrezgene
## 1 13 23551994 23552136 -1 ENSG00000223116 NA
## 2 13 23708313 23708703 1 ENSG00000233440 NA
## 3 13 23726725 23726825 -1 ENSG00000207157 NA
## 4 13 23743974 23744736 -1 ENSG00000229483 NA
## 5 13 23791571 23791673 -1 ENSG00000252952 100873766
## 6 13 23817659 23821323 1 ENSG00000235205 NA
## external_gene_id
## 1 AL157931.1
## 2 HMGA1P6
## 3 RNY3P4
## 4 LINC00362
## 5 RNU6-58P
## 6 TATDN2P3
# 读取信号数据文件 / Read signal data file
# 文件应包含基因ID和对应的信号值 / File should contain gene IDs and corresponding signal values
easy_input <- read.csv('signal.csv')
head(easy_input) # 查看前几行数据 / Check the first few rows of data
## id color group1_s1 group1_s2 group2_s1 group2_s2 group2_s3 group3_s1
## 1 PPAPDC1A black 1.639 0.214 -0.377 -3.097 1.393 0.911
## 2 SHC4 black 1.631 -0.505 -0.651 -0.973 -0.048 -0.666
## 3 ZNF552 black 0.240 -1.252 -1.879 -0.195 -1.691 -0.012
## 4 IL12RB2 black -0.141 2.780 2.338 1.308 0.415 1.321
## 5 ABAT black -0.981 -0.896 -2.019 1.412 -1.366 -1.994
## 6 WWP1 black -1.345 -0.620 0.389 0.301 -0.321 -0.900
## group3_s2 group3_s3
## 1 1.320 -0.154
## 2 0.503 -0.349
## 3 -1.133 0.354
## 4 0.025 2.385
## 5 -0.636 -0.885
## 6 -1.251 -0.264
# 提取目标基因列表 / Extract target gene list
gene_list <- easy_input$id # 从信号数据中获取基因ID / Get gene IDs from signal data
# 根据基因ID匹配染色体位置信息 / Match chromosome locations based on gene IDs
# 从gene.location中筛选出目标基因的位置信息 / Filter location info for target genes from gene.location
gene_list_chr <- gene.location[gene.location$external_gene_id %in% gene_list,]
# 精简数据列,只保留必要信息 / Simplify columns, keep only essential info
# 保留染色体、位置和基因ID三列 / Keep chromosome, position and gene ID columns
gene_list_chr <- gene_list_chr[,c(1,2,7)]
# 重命名列名以便后续处理 / Rename columns for subsequent processing
colnames(gene_list_chr) <- c('chr','position','id')
head(gene_list_chr) # 查看处理后的数据 / Check processed data
## chr position id
## 3145 9 2621834 VLDLR
## 4198 21 31586324 CLDN8
## 5908 7 142829170 PIP
## 6715 6 137464968 IL22RA2
## 7146 15 28000021 OCA2
## 8293 17 37366789 STAC2
# 合并染色体位置信息和信号数据 / Merge chromosome location and signal data
# 通过基因ID进行合并 / Merge by gene ID
gene_chr_fc <- merge(gene_list_chr, easy_input, by='id')
# 去除重复的基因ID / Remove duplicated gene IDs
gene_chr_fc <- gene_chr_fc[!duplicated(gene_chr_fc$id),]
# 保存合并后的数据到新文件 / Save merged data to new file
write.csv(gene_chr_fc, "easy_input.csv", row.names = F)
# 读取CSV文件并存储为data.frame对象gene_chr_fc
# Read CSV file and store as data.frame object gene_chr_fc
gene_chr_fc <- read.csv("easy_input.csv")
# 查看数据集行数和列数
# View the number of rows and columns in the dataset
head(gene_chr_fc)
## id chr position color group1_s1 group1_s2 group2_s1 group2_s2 group2_s3
## 1 ABAT 16 8768422 black -0.981 -0.896 -2.019 1.412 -1.366
## 2 ABCC8 11 17414432 black -2.030 3.128 -3.019 2.328 2.058
## 3 AFF3 2 100162323 black -1.376 1.755 1.066 1.073 -1.844
## 4 AGBL2 11 47681143 black -2.572 -0.516 -1.120 2.709 -0.210
## 5 AGTR1 3 148415571 black 0.160 2.922 -0.966 -2.609 -0.456
## 6 AKR7A3 1 19609052 black -1.560 1.790 -1.542 1.223 1.252
## group3_s1 group3_s2 group3_s3
## 1 -1.994 -0.636 -0.885
## 2 -2.613 0.514 -2.572
## 3 -0.392 -0.842 -0.760
## 4 -1.800 -0.300 -0.709
## 5 -2.007 -0.802 -2.035
## 6 0.743 2.022 -0.871
# 画三组样品的热图,分3层来
# Draw heatmaps for three groups of samples, divided into three layers
# 若不分3层,热图则会挨在一起,无法分开
# If not divided into three layers, the heatmaps will be adjacent and cannot be separated
# 提取第一组样本数据:选取第2、3、1、5、6列
# Extract data for the first group of samples: select columns 2, 3, 1, 5, 6
exp1 <- gene_chr_fc[,c(2,3,1,5,6)]
# 查看数据集行数和列数
# View the number of rows and columns in the dataset
head(exp1)
## chr position id group1_s1 group1_s2
## 1 16 8768422 ABAT -0.981 -0.896
## 2 11 17414432 ABCC8 -2.030 3.128
## 3 2 100162323 AFF3 -1.376 1.755
## 4 11 47681143 AGBL2 -2.572 -0.516
## 5 3 148415571 AGTR1 0.160 2.922
## 6 1 19609052 AKR7A3 -1.560 1.790
# 提取第二组样本数据:选取第2、3、1、7、8、9列
# Extract data for the second group of samples: select columns 2, 3, 1, 7, 8, 9
exp2 <- gene_chr_fc[,c(2,3,1,7,8,9)]
# 提取第三组样本数据:选取第2、3、1、10、11、12列
# Extract data for the third group of samples: select columns 2, 3, 1, 10, 11, 12
exp3 <- gene_chr_fc[,c(2,3,1,10,11,12)]
处理基因名字为一一对应关系,红色连红色,蓝色连蓝色
Process gene names into one-to-one correspondence, with red connected to red and blue connected to blue
# 提取基因标签数据:选取第2、3、1、4列
# Extract gene label data: select columns 2, 3, 1, 4
gene_label <- gene_chr_fc[, c(2,3,1,4)]
# 按照1-22,x,y排序
# Sort chromosomes in order 1-22, X, Y
# 有的数据没有X或Y,小鼠只有1:20也没关系,不用改
# It's okay if the dataset doesn't have X or Y chromosomes (e.g., mouse dataset with 1:20)
# 将chr列转换为因子,指定染色体顺序为1-22, X, Y
# Convert the 'chr' column to a factor with specified chromosome order
gene_label$chr <- factor(gene_label$chr, levels = c(1:22, "X", "Y"))
# 下面去掉多余的factor。也可以不运行这行,对结果没影响
# Remove unused factor levels (optional, no impact on results)
gene_label$chr <- droplevels(gene_label$chr, exclude = if(anyNA(levels(gene_label$chr))) NULL else NA)
# 按染色体排序数据框
# Sort the dataframe by chromosome
gene_label <- gene_label[order(gene_label$chr),]
# 查看数据集行数和列数
# View the number of rows and columns in the dataset
tail(gene_label)
## chr position id color
## 106 21 35885440 RCAN1 black
## 109 21 43159529 RIPK4 black
## 7 22 39348746 APOBEC3A black
## 127 22 29190543 XBP1 black
## 37 X 13587724 EGFL6 red
## 48 X 13789150 GPM6B red
# 红色基因分析
# Analysis for red genes
# 筛选color列为'red'的基因
# Filter genes with 'red' color
gene_link1 <- filter(gene_label, gene_label$color == 'red')
# 移除color列
# Remove the 'color' column
gene_link1 <- gene_link1[, -4]
# 查看数据集行数和列数
# View the number of rows and columns in the dataset
head(gene_link1)
## chr position id
## 1 3 128628709 KIAA1257
## 2 6 19837617 ID4
## 3 11 72465774 STARD10
## 4 X 13587724 EGFL6
## 5 X 13789150 GPM6B
# 生成红色基因两两组合的第一个基因ID
# Generate first gene IDs for all red gene pairs
id11 <- data_frame(id = combn(gene_link1$id, 2)[1, ])
## Warning: `data_frame()` was deprecated in tibble 1.1.0.
## ℹ Please use `tibble()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
# 查看数据集行数和列数
# View the number of rows and columns in the dataset
head(id11)
## # A tibble: 6 × 1
## id
## <chr>
## 1 KIAA1257
## 2 KIAA1257
## 3 KIAA1257
## 4 KIAA1257
## 5 ID4
## 6 ID4
# 生成红色基因两两组合的第二个基因ID
# Generate second gene IDs for all red gene pairs
id1.1 <- data_frame(id1.1 = combn(gene_link1$id, 2)[2, ])
# 将第一个基因ID与基因信息右连接
# Right join first gene IDs with gene information
genelink1 <- gene_link1 %>%
right_join(id11)
## Joining with `by = join_by(id)`
# 将第二个基因ID与基因信息右连接(重命名id列为id1.1)
# Right join second gene IDs with gene information (rename 'id' to 'id1.1')
genelink11 <- gene_link1 %>%
rename(id1.1=id) %>%
right_join(id1.1)
## Joining with `by = join_by(id1.1)`
# 合并两个连接结果形成完整的基因对
# Combine the two joined results to form complete gene pairs
gene_link1 <- cbind(genelink1, genelink11)
# 蓝色基因分析(与红色基因分析流程相同)
# Analysis for blue genes (same process as red genes)
# 筛选color列为'blue'的基因
# Filter genes with 'blue' color
gene_link2 <- filter(gene_label, gene_label$color == 'blue')
# 移除color列
# Remove the 'color' column
gene_link2 <- gene_link2[, -4]
# 生成蓝色基因两两组合的第一个基因ID
# Generate first gene IDs for all blue gene pairs
id22 <- data_frame(id=combn(gene_link2$id, 2)[1, ])
# 生成蓝色基因两两组合的第二个基因ID
# Generate second gene IDs for all blue gene pairs
id2.1<- data_frame(id2.1=combn(gene_link2$id, 2)[2, ])
# 将第一个基因ID与基因信息右连接
# Right join first gene IDs with gene information
genelink2 <- gene_link2 %>%
right_join(id22)
## Joining with `by = join_by(id)`
# 将第二个基因ID与基因信息右连接(重命名id列为id2.1)
# Right join second gene IDs with gene information (rename 'id' to 'id2.1')
genelink22 <- gene_link2 %>%
rename(id2.1=id) %>%
right_join(id2.1)
## Joining with `by = join_by(id2.1)`
# 合并两个连接结果形成完整的基因对
# Combine the two joined results to form complete gene pairs
gene_link2 <- cbind(genelink2, genelink22)
R代表半径位置,W是宽度,cir是染色体
图中的三组样品的文字需要用AI进行标记
包里自带的写染色体名字的位置不合理,也没有参数可以调整,这里提供两种方法来处理:
R represents the radius position, W is the width, and cir is the chromosome
The text of the three sets of samples in the picture needs to be marked with AI
The position of writing chromosome names in the package is unreasonable, and there are no parameters to adjust. Here are two methods to deal with it:
# 创建PDF设备,设置输出文件名为OmicCircos.pdf,宽度和高度均为8英寸
# Create a PDF device with specified width and height
pdf('OmicCircos.pdf', width = 8, height = 8)
# 设置图形边距为0,准备绘制图形
# Set plot margins to zero and prepare the canvas
par(mar=c(0, 0, 0, 0));
# 创建一个空的绘图区域,设置坐标轴范围和标题等属性
# Create an empty plot area with specified ranges and no axes/labels
plot(c(1,800), c(1,800), type="n", axes=FALSE, xlab="", ylab="", main="");
# 绘制染色体刻度
# Draw chromosome scale
circos(R=250, cir="hg19", W=5, type="chr",
print.chr.lab=FALSE, # 自带的名字会跟scale重叠
# The built-in chromosome labels overlap with the scale
scale=TRUE)
# 绘制染色体名称
# Draw chromosome names
# 从文件读取染色体长度信息(从UCSC下载并整理)
# Read chromosome length information from file (downloaded and formatted from UCSC)
chr_info <- read.table("hg19.chrom.sizes.txt")
# 查看数据集行数和列数
# View the number of rows and columns in the dataset
head(chr_info)
## V1 V2
## 1 1 249250621
## 2 2 243199373
## 3 3 198022430
## 4 4 191154276
## 5 5 180915260
## 6 6 171115067
# 准备染色体标签数据框,包含染色体名称、位置和ID
# Prepare chromosome label dataframe with chromosome names, positions, and IDs
chr_label <- data.frame(chr = chr_info$V1, position = (chr_info$V2 + 1)/2, id = chr_info$V1)
# 在指定半径处绘制染色体标签,字体黑色,内部显示,大小0.5
# Draw chromosome labels at specified radius, black color, inside the circle, size 0.5
circos(R=270, cir="hg19", W=2, mapping=chr_label, type="label2", col = "black", side="in", cex=0.5);
# 绘制基因名称,side="out"表示基因名称在圈外部
# Draw gene names outside the circle
circos(R=280, cir="hg19", W=10, mapping=gene_label, type="label", lwd = 0.4, col = gene_label$color,
side="out", cex=0.5);
# 绘制第一个热图,位于半径210处,宽度40
# Draw the first heatmap at radius 210 with width 40
circos(R=210, cir="hg19", W=40, mapping=exp1, type="heatmap2",
cluster=FALSE, col.bar=FALSE, col=NULL, scale = TRUE)
## Warning in circos(R = 210, cir = "hg19", W = 40, mapping = exp1, type =
## "heatmap2", : NAs introduced by coercion
# 绘制第二个热图,位于半径160处,宽度60
# Draw the second heatmap at radius 160 with width 60
circos(R=160, cir="hg19", W=60, mapping=exp2, type="heatmap2",
cluster=FALSE, col.bar=FALSE, col=NULL, scale = TRUE)
## Warning in circos(R = 160, cir = "hg19", W = 60, mapping = exp2, type =
## "heatmap2", : NAs introduced by coercion
# 绘制第三个热图,位于半径110处,宽度60
# Draw the third heatmap at radius 110 with width 60
circos(R=110, cir="hg19", W=60, mapping=exp3, type="heatmap2",
cluster=FALSE, col.bar=FALSE, col=NULL, scale = TRUE)
## Warning in circos(R = 110, cir = "hg19", W = 60, mapping = exp3, type =
## "heatmap2", : NAs introduced by coercion
# 绘制蓝色基因关联,位于半径100处,宽度10
# Draw blue gene links at radius 100 with width 10
circos(R=100, cir="hg19", W=10, mapping=gene_link2, type="link2", lwd=2, col='blue')
# 绘制红色基因关联,位于半径100处,宽度10
# Draw red gene links at radius 100 with width 10
circos(R=100, cir="hg19", W=10, mapping=gene_link1, type="link2", lwd=2, col='red')
# 关闭PDF设备,完成图形绘制
# Close the PDF device to finalize the plot
dev.off()
## png
## 2
修改了染色体名字的位置,顺便修改了scale的位置。
修改后的函数命名为circos_plus,保存为sourceOmiccircos.R,位于当前文件夹。查找#Ya#可看到修改的代码。
Changed the position of chromosome names and also modified the position of scales.
The modified function is named circos_plus and saved as sourceOmiccircos.R in the current folder. Search for # Ya # to see the modified code.
# 加载OmicCircos_plus所需的自定义函数库
# Load custom function library required for OmicCircos_plus visualization
source("sourceOmiccircos.R")
# 创建PDF设备,设置输出文件名为OmicCircos_plus.pdf,宽度和高度均为8英寸
# Create PDF device with specified dimensions for output file
pdf('OmicCircos_plus.pdf', width = 8, height = 8)
# 设置图形边距为0,准备绘制圆形基因组图谱
# Set plot margins to zero to prepare circular genome visualization canvas
par(mar=c(0, 0, 0, 0));
# 创建空绘图区域,设置坐标范围和基本属性
# Create empty plot area with specified coordinate ranges
plot(c(1,800), c(1,800), type="n", axes=FALSE, xlab="", ylab="", main="");
# 绘制染色体框架(使用增强版函数)
# Draw chromosome framework (using enhanced function)
circos_plus(
R=250, # 半径 Radius
cir="hg19", # 基因组版本 Genome version
W=5, # 宽度 Width
type="chr", # 类型:染色体 Type: chromosome
print.chr.lab=TRUE, # 是否显示染色体标签 Whether to display chromosome labels
scale=TRUE # 是否显示刻度 Whether to display scale
)
# 绘制基因名称标签(外圈显示)
# Draw gene name labels (outside the circle)
circos_plus(
R=280, # 半径 Radius
cir="hg19", # 基因组版本 Genome version
W=10, # 宽度 Width
mapping=gene_label, # 映射数据 Mapping data
type="label", # 类型:标签 Type: label
lwd = 0.4, # 线宽 Line width
col = gene_label$color, # 颜色 Color
side="out", # 位置:外侧 Position: outside
cex=0.5 # 字体大小 Font size
);
# 绘制第一组样本热图(半径210,宽度40)
# Draw first sample heatmap (radius 210, width 40)
circos_plus(
R=210, # 半径 Radius
cir="hg19", # 基因组版本 Genome version
W=40, # 宽度 Width
mapping=exp1, # 映射数据 Mapping data
type="heatmap2", # 类型:热图 Type: heatmap
cluster=FALSE, # 是否聚类 Whether to cluster
col.bar=FALSE, # 是否显示颜色条 Whether to display color bar
col=NULL, # 颜色方案 Color scheme
scale = TRUE # 是否显示刻度 Whether to display scale
)
## Warning in circos_plus(R = 210, cir = "hg19", W = 40, mapping = exp1, type =
## "heatmap2", : NAs introduced by coercion
# 绘制第二组样本热图(半径160,宽度60)
# Draw second sample heatmap (radius 160, width 60)
circos_plus(
R=160, # 半径 Radius
cir="hg19", # 基因组版本 Genome version
W=60, # 宽度 Width
mapping=exp2, # 映射数据 Mapping data
type="heatmap2", # 类型:热图 Type: heatmap
cluster=FALSE, # 是否聚类 Whether to cluster
col.bar=FALSE, # 是否显示颜色条 Whether to display color bar
col=NULL, # 颜色方案 Color scheme
scale = TRUE # 是否显示刻度 Whether to display scale
)
## Warning in circos_plus(R = 160, cir = "hg19", W = 60, mapping = exp2, type =
## "heatmap2", : NAs introduced by coercion
# 绘制第三组样本热图(半径110,宽度60)
# Draw third sample heatmap (radius 110, width 60)
circos_plus(
R=110, # 半径 Radius
cir="hg19", # 基因组版本 Genome version
W=60, # 宽度 Width
mapping=exp3, # 映射数据 Mapping data
type="heatmap2", # 类型:热图 Type: heatmap
cluster=FALSE, # 是否聚类 Whether to cluster
col.bar=FALSE, # 是否显示颜色条 Whether to display color bar
col=NULL, # 颜色方案 Color scheme
scale = TRUE # 是否显示刻度 Whether to display scale
)
## Warning in circos_plus(R = 110, cir = "hg19", W = 60, mapping = exp3, type =
## "heatmap2", : NAs introduced by coercion
# 绘制蓝色基因关联(半径100,线宽2,蓝色)
# Draw blue gene connections (radius 100, line width 2, blue color)
circos_plus(
R=100, # 半径 Radius
cir="hg19", # 基因组版本 Genome version
W=10, # 宽度 Width
mapping=gene_link2, # 映射数据 Mapping data
type="link2", # 类型:连接线 Type: link
lwd=2, # 线宽 Line width
col='blue' # 颜色 Color
)
# 绘制红色基因关联(半径100,线宽2,红色)
# Draw red gene connections (radius 100, line width 2, red color)
circos_plus(
R=100, # 半径 Radius
cir="hg19", # 基因组版本 Genome version
W=10, # 宽度 Width
mapping=gene_link1, # 映射数据 Mapping data
type="link2", # 类型:连接线 Type: link
lwd=2, # 线宽 Line width
col='red' # 颜色 Color
)
# 关闭PDF设备,完成图形绘制
# Close PDF device to finalize the plot
dev.off()
## png
## 2
sessionInfo()
## R version 4.5.1 (2025-06-13)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.3 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
##
## locale:
## [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
## [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
## [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
## [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
##
## time zone: UTC
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats4 stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] OmicCircos_1.46.0 GenomicRanges_1.60.0 GenomeInfoDb_1.44.2
## [4] IRanges_2.42.0 lubridate_1.9.4 forcats_1.0.0
## [7] stringr_1.5.2 dplyr_1.1.4 purrr_1.1.0
## [10] readr_2.1.5 tidyr_1.3.1 tibble_3.3.0
## [13] ggplot2_4.0.0 tidyverse_2.0.0 S4Vectors_0.46.0
## [16] BiocGenerics_0.54.0 generics_0.1.4
##
## loaded via a namespace (and not attached):
## [1] sass_0.4.10 utf8_1.2.6 stringi_1.8.7
## [4] hms_1.1.3 digest_0.6.37 magrittr_2.0.4
## [7] evaluate_1.0.5 grid_4.5.1 timechange_0.3.0
## [10] RColorBrewer_1.1-3 fastmap_1.2.0 jsonlite_2.0.0
## [13] httr_1.4.7 UCSC.utils_1.4.0 scales_1.4.0
## [16] jquerylib_0.1.4 cli_3.6.5 rlang_1.1.6
## [19] crayon_1.5.3 XVector_0.48.0 withr_3.0.2
## [22] cachem_1.1.0 yaml_2.3.10 tools_4.5.1
## [25] tzdb_0.5.0 GenomeInfoDbData_1.2.14 vctrs_0.6.5
## [28] R6_2.6.1 lifecycle_1.0.4 pkgconfig_2.0.3
## [31] pillar_1.11.1 bslib_0.9.0 gtable_0.3.6
## [34] glue_1.8.0 xfun_0.53 tidyselect_1.2.1
## [37] knitr_1.50 farver_2.1.2 htmltools_0.5.8.1
## [40] rmarkdown_2.29 compiler_4.5.1 S7_0.2.0